[PATCH 04/11] apparmor: fix: limit the number of levels of policy namespaces
authorJohn Johansen <john.johansen@canonical.com>
Tue, 3 Mar 2026 19:08:02 +0000 (11:08 -0800)
committerSalvatore Bonaccorso <carnil@debian.org>
Thu, 12 Mar 2026 12:28:10 +0000 (13:28 +0100)
commitc5f887add0261202bc280ea4a44b99718ed47256
tree6efc2f83bc4f9ba260efe186591385f4356c6372
parent6acf79cb236bc995cee11147eb6941c47c373e48
[PATCH 04/11] apparmor: fix: limit the number of levels of policy namespaces

Currently the number of policy namespaces is not bounded relying on
the user namespace limit. However policy namespaces aren't strictly
tied to user namespaces and it is possible to create them and nest
them arbitrarily deep which can be used to exhaust system resource.

Hard cap policy namespaces to the same depth as user namespaces.

Fixes: c88d4c7b049e8 ("AppArmor: core policy routines")
Reported-by: Qualys Security Advisory <qsa@qualys.com>
Reviewed-by: Ryan Lee <ryan.lee@canonical.com>
Reviewed-by: Cengiz Can <cengiz.can@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Gbp-Pq: Topic bugfix/all/qsa-2026-apparmor
Gbp-Pq: Name 0004-apparmor-fix-limit-the-number-of-levels-of-policy-na.patch
security/apparmor/include/policy_ns.h
security/apparmor/policy_ns.c